package com.cq.mapper;

import com.cq.pojo.Admin;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: 悠久的苍穹
 * @Date: 2021/1/9 20:21
 * @Description: 管理员dao层
 * @Version: 1.0
 */
@Mapper
@Repository
public interface AdminMapper {
    Admin findAdminByPassword(@Param("name") String name, @Param("password") String password);

    Admin findAdminByPhone(@Param("phone") String phone);

    int updateAdmin(Admin admin);

    Admin findAdminById(@Param("id") Integer id);

    int updatePassword(@Param("password") String password, @Param("id") Integer id);

    int getCount();

    List<Admin> findAllAdmin(@Param("page") int page, @Param("limit") int limit);

    List<Admin> findAllAdminByRoleId(@Param("role_id") int role_id, @Param("page") int page, @Param("limit") int limit);

    int addAdmin(Admin admin);

    Admin findAdminByName(@Param("name") String name);

    void deleteAdminById(@Param("id") int id);

    Admin findAdminByRoleId(@Param("id") Integer id);
}
